<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
		"http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<title>doh.robot Form_onsubmit Test</title>

		<style>
			@import "../../../../util/doh/robot/robot.css";
		</style>

		<!-- required: dojo.js -->
		<script type="text/javascript" src="../../../../dojo/dojo.js"
			djConfig="isDebug: true, parseOnLoad: true"></script>

		<script type="text/javascript" src="../../helpers.js"></script>

		<script type="text/javascript">
			dojo.require("dijit.robotx");

			dojo.addOnLoad(function(){
				doh.robot.initRobot('../test_Form_onsubmit.html');

				doh.register("onsubmit", [
					{
						name: "submit1",
						timeout: 9000,
						runTest: function(){
							var d = new doh.Deferred();
							
							doh.robot.mouseMoveAt("submit1", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							
							doh.robot.sequence(d.getTestCallback(function(){
								doh.is("", dijit.byId("textbox").get('value'));
							}), 1000);
							return d;
						}
					},
					{
						name: "submit2",
						timeout: 9000,
						runTest: function(){
							var d = new doh.Deferred();

							//reset the submit textbox
							dijit.byId("textbox").set('value',"");
														
							doh.robot.mouseMoveAt("submit2", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							
							doh.robot.sequence(d.getTestCallback(function(){
								doh.is("", dijit.byId("textbox").get('value'));
							}), 1000);
							return d;
						}
					},
					{
						name: "submit3",
						timeout: 9000,
						runTest: function(){
							var d = new doh.Deferred();
							
							//reset the submit textbox
							dijit.byId("textbox").set('value',"");

							doh.robot.mouseMoveAt("submit3", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							
							doh.robot.sequence(d.getTestCallback(function(){
								doh.is("one", dijit.byId("textbox").get('value'));
							}), 1000);
							return d;
						}
					},
					{
						name: "submit4",
						timeout: 9000,
						runTest: function(){
							var d = new doh.Deferred();

							//reset the submit textbox
							dijit.byId("textbox").set('value',"");
							
							doh.robot.mouseMoveAt("submit4", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							
							doh.robot.sequence(d.getTestCallback(function(){
								doh.is("one", dijit.byId("textbox").get('value'));
							}), 1000);
							return d;
						}
					},
					{
						name: "testReset1",
						timeout: 9000,
						runTest: function(){
							var d = new doh.Deferred();
							
							doh.robot.mouseMoveAt("combo1", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000, {});
							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
							doh.robot.keyPress(dojo.keys.ENTER, 500, {});
							doh.robot.mouseMoveAt("reset1", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							
							doh.robot.sequence(d.getTestCallback(function(){
								doh.is("two", dijit.byId("combo1").value);
							}), 1000);
							return d;
						}
					},
					{
						name: "testReset2",
						timeout: 9000,
						runTest: function(){
							var d = new doh.Deferred();

							doh.robot.mouseMoveAt("combo2", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000, {});
							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000, {});
							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
							doh.robot.keyPress(dojo.keys.ENTER, 500, {});
							doh.robot.mouseMoveAt("reset2", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							
							
							doh.robot.sequence(d.getTestCallback(function(){
								doh.is("three", dijit.byId("combo2").value);
							}), 1000);
							return d;
						}
					},
					{
						name: "testReset3",
						timeout: 9000,
						runTest: function(){
							var d = new doh.Deferred();
							
							doh.robot.mouseMoveAt("combo3", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
							doh.robot.keyPress(dojo.keys.ENTER, 500, {});
							doh.robot.mouseMoveAt("reset3", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							
							doh.robot.sequence(d.getTestCallback(function(){
								doh.is("one", dijit.byId("combo3").value);
							}), 1000);
							return d;
						}
					},
					{
						name: "testReset4",
						timeout: 9000,
						runTest: function(){
							var d = new doh.Deferred();

							doh.robot.mouseMoveAt("combo4", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000, {});
							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
							doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
							doh.robot.keyPress(dojo.keys.ENTER, 500, {});
							doh.robot.mouseMoveAt("reset4", 500, 0);
							doh.robot.mouseClick({left:true}, 500);
							
							
							doh.robot.sequence(d.getTestCallback(function(){
								doh.is("one", dijit.byId("combo4").value);
							}), 1000);
							return d;
						}
					}
				]);
				doh.run();
			});
		</script>
	</head>
</html>
